#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>

using namespace std;
int n, m, k;
vector<int> v;
const int dir[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };
int cal(int i, int j) {
    int cnt = 1;
    for (int d = 0; d < 4; d++) {
        int x = i + dir[d][0], y = j + dir[d][1];
        if (x > 0 && x <= n && y > 0 && y <= m) cnt++;
    }
    return cnt;
}
void Solve_question() {
    v.clear();
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++) v.push_back(cal(i, j));
    sort(v.begin(), v.end());
    int ans = 0;
    for (int i = v.size() - 1; i >= 0; i--)
        if (k) ans += v[i] + 1, k--;
        else ans += 1;
    printf("%d\n", ans);
}
int main() {
    int T;
    scanf("%d", &T);
    while (T--) {
        scanf("%d %d %d", &n, &m, &k);
        Solve_question();
    }
}